//
//  ParLeaCountTableViewCell.m
//  ChatDemo-UI2.0
//
//  Created by zz on 17/2/20.
//  Copyright © 2017年 zz. All rights reserved.
//

#import "ParLeaCountTableViewCell.h"

@implementation ParLeaCountTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        _selStuLabel = [[UILabel alloc] initWithFrame:CGRectMake(22, 17, 65, 16)];
        _selStuLabel.font = [UIFont systemFontOfSize:15];
        _selStuLabel.textColor = [UIColor colorWithHexString:@"#3b3b3b"];
        _selStuLabel.text = @"选择宝宝";
        [self.contentView addSubview:_selStuLabel];
        
        //选择学生按钮
        _selStuBtn = [ParAtdselBtn buttonWithFrame:CGRectMake(CGRectGetMaxX(_selStuLabel.frame) + 8, 12, 192, 26) title:@"李小二  一年级四班" target:nil target:self];
        [self.contentView addSubview:_selStuBtn];
        
        //选择时间label
        _selDateLabel = [[UILabel alloc] initWithFrame:CGRectMake(22, CGRectGetMaxY(_selStuBtn.frame) + 12 + 5, 65, 16)];
        _selDateLabel.text = @"选择时间";
        _selDateLabel.font = [UIFont systemFontOfSize:15];
        _selDateLabel.textColor = [UIColor colorWithHexString:@"#3b3b3b"];
        [self.contentView addSubview:_selDateLabel];
        
        //选择时间按钮
        _selDateBtn = [ParAtdselBtn buttonWithFrame:CGRectMake(CGRectGetMaxX(_selStuLabel.frame) + 8, CGRectGetMaxY(_selStuBtn.frame) + 12, 92, 26) title:@"2017年2月" target:nil target:self];
        [self.contentView addSubview:_selDateBtn];
     
        _midLineView = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_selDateBtn.frame) + 12, SCREENWIDTH, 0.5)];
        _midLineView.backgroundColor = [UIColor colorWithHexString:@"#dedede"];
        [self.contentView addSubview:_midLineView];
        
        //四个小点
        
        CGFloat X,midX,secX,Y,secY,W;
        
        W = 110;
        midX = SCREENWIDTH / 2;
        X = (midX - W) / 2;
        secX = midX + X;
        
        Y = CGRectGetMaxY(_midLineView.frame) + 12;
        
        _attView = [[ParLeaveCountView alloc] initWithFrame:CGRectMake(X, Y, W, 16)];
        _attView.desTitle = @"出勤";
        [self.contentView addSubview:_attView];
        
        _noRcdView = [[ParLeaveCountView alloc] initWithFrame:CGRectMake(secX, Y, W, 16)];
        _noRcdView.desTitle = @"无记录";
        [self.contentView addSubview:_noRcdView];

        secY = CGRectGetMaxY(_attView.frame) + 15;
        
        _leaveView = [[ParLeaveCountView alloc] initWithFrame:CGRectMake(X, secY, W, 16)];
        _leaveView.desTitle = @"请假";
        [self.contentView addSubview:_leaveView];

        _crunkView = [[ParLeaveCountView alloc] initWithFrame:CGRectMake(secX, secY, W, 16)];
        _crunkView.desTitle = @"旷课";
        [self.contentView addSubview:_crunkView];

    }
    
    return self;
}

- (void)setRecodeDict:(NSDictionary *)recodeDict{
    
    NSString *attendday = [[recodeDict objectForKey:@"attendday"] stringValue];
    NSString *leaveday = [[recodeDict objectForKey:@"leaveday"] stringValue];
    NSString *absentday = [[recodeDict objectForKey:@"absentday"] stringValue];
    NSString *norecordday = [[recodeDict objectForKey:@"norecordday"] stringValue];
    
    _attView.countTitle = attendday;
    _leaveView.countTitle = leaveday;
    _crunkView.countTitle = absentday;
    _noRcdView.countTitle = norecordday;
    
}

@end
